package api;

import java.util.ArrayList;

/**
 * @Author admin
 * @Date 2019/3/27 11:31
 */
public class ArrayListTest {
    public static void main(String[] args) {
        /*Arraylist,看做长度可变的数组
        * 元素可重复，有序
        * 添加内容：add()
        * 取出内容：get()*/
        ArrayList arrayList=new ArrayList();
        arrayList.add("hello ");
        arrayList.add("java ");
        arrayList.add("mysql ");


        System.out.println(arrayList.get(0));
        System.out.println(arrayList.size());


        /*用ArrayList存取整型，Studengt*/

        ArrayList num = new ArrayList();
        int a0=3,a1=2,a3=5,a4=7;
        num.add(a0);

        Student1 student0=new Student1("张三",19);
        Student1 student1=new Student1("历史",200);

        ArrayList list3=new ArrayList();
        list3.add(student0);
        list3.add(student1);

        for (int i=0;i<list3.size();i++){
            System.out.println(list3.get(i));
        }
    }
}
